package com.hzky.demo.model;

import javax.persistence.*;
import java.util.List;

/**
 * Created by admin on 2017/6/6.
 */

@Entity
@Table(name = "parent")
public class Parent {

    @Id
    @Column(name = "phone_number")
    String phone_number;

    @Column(name = "name",nullable=false)
    String name;

    @Column(name = "mail")
    String mail;

    @Column(name="password",nullable = false)
    String password;

    @Column(name = "location",nullable = false)
    String location;

    @Column(name = "picture")
    String picture;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "school_id", nullable = false)
    School school;


    @ManyToMany
    @JoinTable(name = "parents_activity",
            joinColumns = {@JoinColumn(name = "p_phone",referencedColumnName = "phone_number")},
            inverseJoinColumns = {@JoinColumn(name = "activity_id",referencedColumnName = "id")})
    List<Activity> JoinedActivity;

    public String getPhone_number() {
        return phone_number;
    }

    public void setPhone_number(String phone_number) {
        this.phone_number = phone_number;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public School getSchool() {
        return school;
    }

    public void setSchool(School school) {
        this.school = school;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public List<Activity> getJoinedActivity() {
        return JoinedActivity;
    }

    public void setJoinedActivity(List<Activity> joinedActivity) {
        JoinedActivity = joinedActivity;
    }
}
